<template>
  <el-container>
    <el-header>
      <FHeader></FHeader>
    </el-header>

    <el-container>
      <el-aside :style="{ width: $store.state.asideWidth }">
        <FMenu></FMenu>
      </el-aside>

      <el-main>
        <FTagList></FTagList>
        <!--
          v-slot="{Component}" 拿到点击切换时的组件
          :max="10" 超过10个时，最久没有被访问的组件就会被销毁
        -->
        <router-view v-slot="{ Component }">
          <transition name="fade">
            <keep-alive :max="10">
              <component :is="Component"></component>
            </keep-alive>
          </transition>
        </router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup>
import FHeader from "./components/FHeader.vue";
import FMenu from "./components/FMenu.vue";
import FTagList from "./components/FTagList.vue";
</script>

<style lang="less">
.el-aside {
  transition: all 200ms;
}

.fade-enter-from {
  opacity: 0;
}
.fade-enter-to {
  opacity: 1;
}
.fade-leave-from {
  opacity: 1;
}
.fade-leave-to {
  opacity: 0;
}
.fade-enter-active,
.fade-leave-active {
  transition: all 300ms;
}
.fade-enter-active {
  // 进入动画的时候延迟，就是离开动画执行完，我们再让它进入
  transition-delay: 300ms; // 离开动画是300ms，我们这里就延迟300ms
}
</style>
